import sys
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import Qt 

class SlaveMarketMonitor(QtGui.QWidget):
	def __init__(self, *args, **kw):
		QtGui.QWidget.__init__(self, *args, **kw)
#
#		background image
#
		background = QtGui.QLabel(self)
		#path = "resources/slave_market_trait_panel.png"
		path = "resources/slave_market_monitor.png"
		background.setPixmap(QtGui.QPixmap(path))
		background.setGeometry(0, 0, 240, 227)
#
#		now let's have a label to show the text
#
		text = QtGui.QLabel(self)
		text.setGeometry(32, 49, 176, 146)
#
#		specify word wrap and justification
#
		text.setWordWrap(True)
		text.setAlignment(Qt.AlignVCenter|Qt.AlignHCenter)
#
#		font and text colour
#
		font = QtGui.QFont("White Rabbit", 12)
		text.setFont(font)
		#text.setStyleSheet("color:green")
		text.setStyleSheet("color:#00a800")

		s = "+++ no signal +++"
		text.setText(s)
		self.text = text

	def set_text(self, s):
		self.text.setText(s)

if __name__  == "__main__":
#
#	make an app object
#
	app = QtGui.QApplication(sys.argv)
#
#	add the font we're going to use to the font database
#
	font_db = QtGui.QFontDatabase()
	font_db.addApplicationFont("resources/whitrabt.ttf")
#
#	set up the wood texture as a background, just so we can see
#	how it looks in context
#
	path = "resources/wood.jpg"
	bg = QtGui.QLabel()
	bg.setPixmap(QtGui.QPixmap(path))
	bg.setGeometry(0, 0, 280, 340)
#
#	now make the monitor
#
	monitor = SlaveMarketMonitor(bg)
	monitor.setGeometry(20, 20, 240, 227)
	s = "Abby's Crossing is a minor desert city, situated at the junction of two trade roads, and sheltered in the lee of a towering natural escarpment. The city is best known for the Great Laboratory, home of the Science Guild"
	monitor.set_text(s)

#
#	show and run
#
	bg.show()
	sys.exit(app.exec_())

